package auctionhaus

import com.auctionhaus.Customer
import com.auctionhaus.Listing
import grails.converters.*

class NotificationController {

    def index = {
        def message = "Hi, this is a Hello World with JMS & ActiveMQ, " + new Date()
        sendJMSMessage("queue.notification", message)
        render message
    }

    def sendListing = {
        def customerSeller = Customer.findByEmailAddress("seller0@gmail.com")

        def k = new Date().seconds
        def l = new Listing(creationDate:new Date(), listName:"XML created Listing $k",endDateTime:new Date() + 5, startBidPrice:100, seller:customerSeller)
        def message = l as XML
        sendJMSMessage("queue.listing.listener", message.toString())
        render message
    }
}
